{% set page_name = "用户列表" %}
{% import "components/nothing.html" as nothing with context %}
{% import "components/paginator.html" as paginator with context %}
{% extends "manage_base.html" %}
{% block manage_content %}
        <div class="section">
            <div class="section__header">
                <h1 class="section__title">{{ _('用户列表') }}</h1>
                <div class="section__tools">
	        </div>
            </div>
            <div class="section__body no-padding">
                <div data-fragment-id="ranking">
                    {% if not udocs.length %}
                    {{ nothing.render('没有用户！') }}
                    {% else %}
                    <table class="data-table">
                        <colgroup>
                            <col class="col--uid" style="width:5rem">
                            <col class="col--user" style="width:20rem">
                            <col class="col--school" style="width:8rem">
                            <col class="col--groups" style="width:8rem">
                            <col class="col--bio">
                        </colgroup>
                        <thead>
                            <tr>
                                <th class="col--uid">{{ _('User ID') }}</th>
                                <th class="col--user">{{ _('Username') }}</th>
                                <th class="col--school">{{ _('School') }}</th>
                                <th class="col--groups"><a href="{{ url('用户列表') }}">{{ _('小组') }}</a></th>
                                <th class="col--bio">{{ _('Bio') }}</th>
                            </tr>
                        </thead>
                        <tbody>
                            {%- for udoc in udocs -%}
                            <tr>
                                <td class="col--uid">{{ udoc._id }}</td>
                                <td class="col--user">{{ user.render_inline(udoc) }}</td>
                                <td class="col--school">{{ udoc.school }}</td>
                                <td class="col--groups">
                                {%- for group in groups -%}
                                {%- if udoc._id in group.uids -%}
                                 <a href="{{ url('用户列表') }}?group={{ group.name }}">{{ group.name }}</a>{{ ' ' }}
                                {%- endif -%}
                                {%- endfor -%}
                                </td>
                                <td class="col--bio">{{ udoc.bio|default('')|truncate(64, true)|markdownInline|safe }}</td>
                            </tr>
                            {%- endfor -%}
                        </tbody>
                    </table>
                    {{ paginator.render(page, upcount,add_qs=('group=' + group if group else '')) }}
                    {% endif %}
                </div>
            </div>
        </div>
{% endblock %}